

//
//  LYPrivacySettingCell.m
//  SelectCity
//
//  Created by liuyan on 2019/3/29.
//  Copyright © 2019年 liuyan. All rights reserved.
//

#import "LYPrivacySettingCell.h"

@interface LYPrivacySettingCell()

@property (nonatomic, strong) UILabel *titlelabel;
@property (nonatomic, strong) UIButton *canclebtn;

@end

@implementation LYPrivacySettingCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if ([super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self initSubViews];
        self.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return self;
}

#pragma mark - InitSubViews
- (void)initSubViews{
    self.canclebtn = [UIButton buttonWithType:UIButtonTypeCustom];
    self.canclebtn.frame = CGRectMake(WIDTH - 25- 20, 13.5, 18, 18);
    [self.canclebtn setTitle:@"X" forState:UIControlStateNormal];
    [self.canclebtn setTitleColor:[UIColor orangeColor] forState:UIControlStateNormal];
    self.canclebtn.titleLabel.font = [UIFont systemFontOfSize:13];
    [self.canclebtn addTarget:self action:@selector(buttonClick:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:self.canclebtn];
    
    self.titlelabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 0, self.canclebtn.left - 25, 45)];
    self.titlelabel.font = [UIFont systemFontOfSize:14];
    self.titlelabel.textColor = RGB(34, 34, 34);
    [self.contentView addSubview:self.titlelabel];
    
    UIView *line = [[UIView alloc] initWithFrame:CGRectMake(20, 44, WIDTH - 40, 1)];
    line.backgroundColor = RGB(247, 247, 247);
    [self.contentView addSubview:line];
}

-(void)setTitle:(NSString *)title{
    _titlelabel.text = title;
}

#pragma mark --Action
- (void)buttonClick:(UIButton *)button{
    _block();
}


@end
